<template>
  <div>
    <h1>FieldMapping Edit</h1>

    <el-form label-width="80px">
      <el-form-item label="pipelineId">
        <el-input v-model="fieldMapping.pipelineId"></el-input>
      </el-form-item>
      <el-form-item label="fieldName">
        <el-input v-model="fieldMapping.fieldName"></el-input>
      </el-form-item>
      <el-form-item label="fieldValue">
        <el-input v-model="fieldMapping.fieldValue"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">提交</el-button>
        <el-button @click="$router.go(-1)">返回</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fieldMapping: {}
    }
  },

  methods: {
    loadById() {
      if (!this.$route.query.id) {
        return;
      }

      var _this = this;
      sdk.FieldMappingApi().findById({
        id: _this.$route.query.id
      }).then(res => {
        _this.fieldMapping = res;
      });
    },

    onSubmit() {
      if (!this.$route.query.id) {
        this.update();
        return;
      }

      this.insert();
    },

    insert() {

    },

    update() {

    }
  },

  mounted(){
    this.loadById();
  }
};
</script>

<style>
</style>